using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace ProjectSurvivor
{
    public class DemageSystem
    {
        public static void CalculateDemage(float baseDemage,IEnemy enemy,int maxNormalDemage = 2,float cirticalDemageTimes= 5)
        {
            baseDemage *= Global.DemageRate.Value;
            if(Random.Range(0,1.0f)<Global.CirticalRate.Value)
            {
                enemy.Hurt(baseDemage * Random.Range(2f, cirticalDemageTimes),false,true);
            }
            else
            {
                enemy.Hurt(baseDemage + Random.Range(-1, maxNormalDemage));

            }
            
        }
    }

}
